function bankSubmit(){
	var idNo = $("#idNo").val();
	var realName = $("#realName").val();
	buttonDis(1);
	if($.trim($("#bankName").val()) == "" || $.trim($("#subBankName").val())== "" || $.trim($("#bankCard").val())== "" ){
		showMsg("请完整填写信息");
		buttonDis(2);
		return;
	}else if(isNaN($("#bankCard").val())){
		showMsg("请输入正确的银行卡号");
		buttonDis(2);
		return;
	}
	bankBinding();
}



function bankBinding(){
	var param = {};
	param["paramMap.bankName"] = $("#bankName").val();
    param["paramMap.subBankName"] = $("#subBankName").val();
    param["paramMap.bankCard"] = $("#bankCard").val();
    param["paramMap.cardUserName"] = $("#cardUserName").text();
    $.ajax({
		url: "addBankInfo.do",
		type: "post",
		data: param,
		async: false,
		success: function(data) {
    		if(data == 1){
    			showMsg("请输入有效的银行卡信息");
    			onfocusText("bankCard");//银行卡信息错误，只清空银行卡信息
    			buttonDis(2);
    		}else if(data == 2){
    			showMsg("你已经添加了两张银行卡信息，可以登录官网删除未绑定的银行卡或申请更换银行");
    			buttonDis(2);
    		}else{
    			showMsg("申请绑定成功");
    			buttonDis(2);
				location.href = "bankManager.do";
			}
    					
		}
	});
}

function showMsg(msg){
	$("#errorMsg").html("<div class='onError'>"+msg+"</div>");
}

function onfocusText(id){
	$("#"+id).html("&nbsp;");
	$("#errorMsg").html("&nbsp;");
}

function buttonDis(flag){
	var obj = document.getElementById("submitButton");
	if(flag==1){
		obj.innerHTML = "提交中...";
		obj.disabled = true;
	}else{
		obj.innerHTML = "提&nbsp;&nbsp;&nbsp;&nbsp;交";
		obj.disabled = false;
	}
}


